package com.dein.broadcast.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dein.broadcast.dao.BroadcastFavoriteDao;
import com.dein.broadcast.model.Broadcast;
import com.dein.broadcast.service.BroadcastFavoriteService;

@Service
public class BroadcastFavoriteServiceImpl implements BroadcastFavoriteService {

	@Autowired
	private BroadcastFavoriteDao broadcastFavoriteDao;

	@Override
	public boolean addFavoriteBroadcast(long userId, int broadcastId) {
		try {
			broadcastFavoriteDao.addFavoriteBroadcast(userId, broadcastId);
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}

	@Override
	public boolean deleteFavoriteBroadcast(long userId, int broadcastId) {
		try {
			broadcastFavoriteDao.deleteFavoriteBroadcast(userId, broadcastId);
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}

	@Override
	public List<Broadcast> getFavoriteBroadcastList(long userId) {
		return broadcastFavoriteDao.getFavoriteBroadcastList(userId);
	}

}
